import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PeopleInfoVO, PeopleInfoForm, PeopleInfoQuery } from '@/api/business/peopleInfo/types';

/**
 * 查询用户信息列表
 * @param query
 * @returns {*}
 */

export const listPeopleInfo = (query?: PeopleInfoQuery): AxiosPromise<PeopleInfoVO[]> => {
  return request({
    url: '/business/peopleInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询用户信息详细
 * @param id
 */
export const getPeopleInfo = (id: string | number): AxiosPromise<PeopleInfoVO> => {
  return request({
    url: '/business/peopleInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增用户信息
 * @param data
 */
export const addPeopleInfo = (data: PeopleInfoForm) => {
  return request({
    url: '/business/peopleInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改用户信息
 * @param data
 */
export const updatePeopleInfo = (data: PeopleInfoForm) => {
  return request({
    url: '/business/peopleInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除用户信息
 * @param id
 */
export const delPeopleInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/business/peopleInfo/' + id,
    method: 'delete'
  });
};

/**
 * 查询多个用户信息详细
 * @param id
 */
export const getPeopleBatchInfo = (id: string | number): AxiosPromise<PeopleInfoVO> => {
  return request({
    url: '/business/peopleInfo/batch/' + id,
    method: 'get'
  });
};

/**
 * 新增用户信息
 * @param data
 */
export const addPeopleBatchInfo = (data: PeopleInfoForm) => {
  return request({
    url: '/business/peopleInfo/batch',
    method: 'post',
    data: data
  });
};

/**
 * 修改用户信息
 * @param data
 */
export const updatePeopleBatchInfo = (data: PeopleInfoForm) => {
  return request({
    url: '/business/peopleInfo/batch',
    method: 'put',
    data: data
  });
};

/**
 * 删除用户信息
 * @param id
 */
export const delPeopleBatchInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/business/peopleInfo/batch/' + id,
    method: 'delete'
  });
};

/**
 * 修改用户信息
 * @param data
 */
export const renewalOfContract = (data: any) => {
  return request({
    url: '/business/peopleInfo/renewalOfContract',
    method: 'put',
    data: data
  });
};
